package com.flexrrb.effects
{
	import mx.effects.IEffectInstance;
	import mx.effects.TweenEffect;

	public class Scale extends TweenEffect
	{
		public var scaleXTo:Number;
		public var scaleYTo:Number;
		
		public var scaleTo:Number= NaN;
		
		public function Scale(target:Object=null)
		{
			super(target);
			instanceClass = ScaleEffectInstance;
		}
		
		override public function getAffectedProperties():Array
		{
			return ["scaleX", "scaleY"];
		}
		
		override protected function initInstance(instance:IEffectInstance):void
		{
			super.initInstance(instance);
			
			if(isNaN(scaleTo))
			{ 
				ScaleEffectInstance(instance).scaleXTo = scaleXTo;
				ScaleEffectInstance(instance).scaleYTo = scaleYTo;
			}
			else
			{
				ScaleEffectInstance(instance).scaleXTo = ScaleEffectInstance(instance).scaleYTo = scaleTo;
			}
		}
	}
}